package com.ll.blog.contant;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Objects;

@Getter
public enum TypeEnum {
    MESSAGE(0, "留言"),
    CONTENT(1, "评论");
    @EnumValue
    private Integer value;
    @JsonValue
    private String desc;

    TypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static TypeEnum codeToEnum(Integer i){
        for (TypeEnum value : values()) {
            if (Objects.equals(value.value, i)){
                return value;
            }
        }
        return null;

    }
}
